function mod = minimod(a,b,c)
if sign(a) == sign(b) && sign(b) == sign(c)
    mod = sign(a)*min(abs(a),min(abs(b),abs(c)));
else
    mod = 0;
end
end